package com.hiyee.api.controller.admin;

import com.hiyee.pojo.bo.AdminUserLoginBO;
import com.hiyee.pojo.bo.UpdateAdminUserBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

@Api(value = "管理员控制器", tags = {"管理员控制器"})
@RequestMapping("adminMng")
public interface AdminUserControllerApi {

    @ApiOperation(value = "管理员登录", notes = "管理员登录")
    @PostMapping("/adminLogin")
    public Object login(@RequestBody @Valid AdminUserLoginBO adminUserLoginBO,
                        BindingResult bindingResult,
                        HttpServletRequest request,
                        HttpServletResponse response);

    @ApiOperation(value = "查询管理员账户唯一性", notes = "查询管理员账户唯一性")
    @PostMapping("/checkUsername")
    public Object checkUnique(@RequestParam String username);

    @ApiOperation(value = "添加管理员", notes = "添加管理员")
    @PostMapping("/addNewAdmin")
    public Object addNewAdmin(@RequestBody @Valid UpdateAdminUserBO updateAdminUserBO,
                              BindingResult bindingResult,
                              HttpServletRequest request,
                              HttpServletResponse response);

    @ApiOperation(value = "管理员列表", notes = "管理员列表")
    @GetMapping("/getAdminList")
    public Object getAdminList(
            @ApiParam(name = "page", value = "页数", required = false)
            @RequestParam Integer page,
            @ApiParam(name = "pageSize", value = "每页显示记录数", required = false)
            @RequestParam Integer pageSize);

    @ApiOperation(value = "管理员退出登录", notes = "管理员退出登录")
    @PostMapping("/logout")
    public Object logout(
            @RequestParam String adminId, HttpServletRequest request, HttpServletResponse response);
}
